﻿<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<%
function GUID(){
	return new ActiveXObject("Scriptlet.TypeLib").Guid.toString().substring(0,38);
}


	var dom = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
	dom.async = false;
	dom.load(Server.MapPath("userdata/misshjn.fml"));
	
	var xmlxslt = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
	xmlxslt.async = false;
	//xmlxslt.preserveWhiteSpace = false;
	//xmlxslt.validateOnParse = false;
	//xmlxslt.resolveExternals = true;
	xmlxslt.load( Server.MapPath("cattree.xsl") );
	
	var xmldom = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
	dom.transformNodeToObject(xmlxslt,xmldom);
	
	var allfav = xmldom.selectNodes("/root/favorites//*");
	for(var i=0,len=allfav.length; i<len; i++){
		allfav[i].setAttribute("guid",GUID());
	}
	var favs = xmldom.selectNodes("/root/favorites//fav");
	for(var i=0,len=favs.length; i<len; i++){
		favs[i].removeAttribute("id");
		favs[i].removeAttribute("catid");
	}
	
	xmldom.save(Server.MapPath("userdata")+"\\misshjn.xml");
	Response.Write(1);
%>